package com.googlecode.cswish.struts.spring;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

import com.googlecode.cswish.struts.StartupManager;

public class SpringApplicationContext implements ApplicationContextAware {

	private static ApplicationContext context;
	@Override
	public void setApplicationContext(ApplicationContext applicationContext)
			throws BeansException {
		this.context = applicationContext;
		StartupManager manager = (StartupManager) context.getBean("StartupManager");
		manager.startup(null, (BeanDefinitionRegistry) context);
	}
	
	public static ApplicationContext getContext(){
		return context;
	}
}
